﻿<UserControl x:Class="SynthNet.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:oxy="clr-namespace:OxyPlot.Silverlight;assembly=OxyPlot.Silverlight"
    mc:Ignorable="d"
    d:DesignHeight="600" d:DesignWidth="800"
    Loaded="OnLoaded">

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <MediaElement x:Name="mediaElement" />
        <StackPanel Grid.Row="0" Orientation="Horizontal">
            <Button x:Name="play" Content="{Binding Path=PlayContent, Mode=TwoWay}" Margin="5" Width="80" Height="20" Click="OnPlay" />
            <Button x:Name="addWave" Content="Add Wave" Margin="5" Width="80" Height="20" Click="OnAddWave" />
        </StackPanel>
        <ListBox Grid.Row="1" ItemsSource="{Binding Waves, Mode=OneWay}" >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <CheckBox Margin="5" VerticalAlignment="Center" IsChecked="{Binding Path=Enabled, Mode=TwoWay}"/>
                        <TextBlock Text="Frequency:" Margin="5" VerticalAlignment="Center" />
                        <StackPanel VerticalAlignment="Center" Orientation="Vertical" >
                            <TextBox Margin="5" Width="100" Height="20" Text="{Binding Value, ElementName=f, Mode=TwoWay}"/>
                            <Slider x:Name="f" Width="100" Minimum="100" Maximum="1000" Value="{Binding Path=Frequency, Mode=TwoWay}" />
                        </StackPanel>
                        <TextBlock Text="Amplitude:" Margin="5" VerticalAlignment="Center" />
                        <StackPanel VerticalAlignment="Center" Orientation="Vertical" >
                            <TextBox Margin="5" Width="100" Height="20" Text="{Binding Value, ElementName=a, Mode=TwoWay}"/>
                            <Slider x:Name="a" Width="100" Minimum="0" Maximum="1" Value="{Binding Path=Amplitude, Mode=TwoWay}" />
                        </StackPanel>
                        <TextBlock Text="Offset:" Margin="5" VerticalAlignment="Center" />
                        <StackPanel VerticalAlignment="Center" Orientation="Vertical" >
                            <TextBox Margin="5" Width="100" Height="20" Text="{Binding Value, ElementName=o, Mode=TwoWay}"/>
                            <Slider x:Name="o" Width="100" Minimum="0" Maximum="1000" Value="{Binding Path=Offset, Mode=TwoWay}"/>
                        </StackPanel>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <oxy:Plot Grid.Row="2" Model="{Binding Path=Chart}" />
    </Grid>

</UserControl>
